package com.myy.auth.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.myy.auth.service.SystemService;
import com.myy.auth.vo.DictVo;
import com.myy.auth.vo.SystemSearchVo;
import com.myy.auth.vo.SystemVo;
import com.myy.common.result.Result;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统接口
 */
@AllArgsConstructor
@RestController
@RequestMapping("system")
public class SystemController {
    private SystemService systemService;
    /**
     * 系统创建
     */
    @PostMapping("save")
    public Result<String> saveOrUpdate(@RequestBody SystemVo vo){
        return Result.success(systemService.saveOrUpdate(vo));
    }
    /**
     * 系统分页
     */
    @PostMapping("page")
    public Result<IPage<SystemVo>> selectPage(@RequestBody SystemSearchVo searchVo){
        return Result.success(systemService.selectPage(searchVo));
    }
    /**
     * 系统列表
     */
    @GetMapping("list")
    public Result<List<DictVo>> selectList(@RequestParam(required = false) String name){
        return Result.success(systemService.selectList(name));
    }
}
